package common;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.Date;

/**
 * Created by lx on 2017/7/4.
 */
public class Page<T> {
    public static final Long DEFAULTSIZE = 10L;
    public static final Long DEFAULTINDEX = 1L;
    public static final Integer DEFAULTISALL = 1;

    //实体参数
    private T param;

    private Long pageSize ;

    private Long pageIndex;

    private Long pageStart;
    //排序
    private String order;
    //是否查询全部 1 : 否,2:是
    private Integer IsAll;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date startDate;
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date endDate;

    public T getParam() {
        return param;
    }

    public void setParam(T param) {
        this.param = param;
    }

    public Long getPageSize() {
        return pageSize;
    }

    public void setPageSize(Long pageSize) {
        if(pageSize == null){
            this.pageSize = DEFAULTSIZE;
        }else {
            this.pageSize = pageSize;
        }
    }

    public Long getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Long pageIndex) {
        if(pageIndex == null){
            this.pageIndex = DEFAULTINDEX;
        }else {
            this.pageIndex = pageIndex;
        }
    }

    public Long getPageStart() {
        return pageStart;
    }

    public void setPageStart(Long pageStart) {
        this.pageStart = pageStart;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    public Integer getIsAll() {
        return IsAll;
    }

    public void setIsAll(Integer isAll) {
        if(isAll == null){
            this.IsAll = DEFAULTISALL;
        }else
        this.IsAll = isAll;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }
}
